/*******************************************
 * Copyright 2007 Aphrodite Framework for javaME .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * Email : owner@aphroditeme.dev.java.net
 * Contributors:
 *     Kent Elton - initial API and implementation
 *******************************************/

package com.aphrodite.util.geom;

/**
 * A Rectangle specifies an area in a coordinate space that is enclosed by the
 * Rectangle object's top-left point (x, y) in the coordinate space, its width,
 * and its height.
 * 
 * @author kentelt
 * 
 */
public final class Rectangle extends Shape {

	int height;
	int width;

	public Rectangle() {
		this(0, 0, 0, 0);
	}

	public Rectangle(int x, int y, int width, int height) {
		super(x, y);
		this.width = width;
		this.height = height;

	}

	public Rectangle(Rectangle rect) {
		this(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
	}

	public int getHeight() {
		return height;
	}

	public int getWidth() {
		return width;
	}

	/**
	 * Increases the dimensions of the rectangle
	 * 
	 * @param w
	 * @param h
	 */
	public void grow(int w, int h) {
		width += w;
		height += h;
	}

	public void setBounds(int x, int y, int width, int height) {
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public void setWidth(int width) {
		this.width = width;
	}

}
